/**
 * Created by yeanzhi on 15/7/13.
 */
var nodemailer = require('nodemailer');
var co = require('co'),
	request = require('request'),
	schedule = require("node-schedule"),
	cheerio  = require('cheerio'),
	db = require('./db');
var email = require("emailjs/email");
var server = email.server.connect({
	user: "a1308118099@163.com",
	password: "s807754634",
	host: "smtp.163.com",
	ssl: true
});

var sendemail = function(){
	server.send({
		text: "吃饭吃饭",
		from: "监督小AQ吃饭 <a1308118099@163.com>",
		to: 'ximing@yeanzhi.cn',
		subject: "要不胃疼",
		attachment: [
			{
				data: '<html><body>按时吃饭</body> </html>',
				alternative: true
			}
		]
	}, function (err, message) {
	});
};

var rule = new schedule.RecurrenceRule();
rule.hour = [8,11,17,20];
rule.minute = 0;
var j = schedule.scheduleJob(rule, function(){
	sendemail()
});